<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="purchase.domain.Purchase"%>

<% 
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>addPayment</title>
<script type="text/javascript" src="<%=path %>/purchase/Toolkit.js"></script>
<script type="text/javascript">

function validateForm() {
	//var title = document.getElementById("title"); 
	//var remark = document.getElementById("remark"); 
	
	//if (title.value == "") {
	//	alert("Title is null.");
	//	return;
	//} else if (remark.value == "") {
	//	alert("Remark is null.");
	//	return;
	//}  

	document.frm.submit();
}

</script>
</head>
<body>
<%
	Purchase purchase = (Purchase)request.getAttribute("purchase");
	Long id = purchase.getId();
	String title = purchase.getTitle();
	String remark = purchase.getRemark();
	String issuePerson = purchase.getTaskBean().getProcessInstanceCreater();
	String processStatus = purchase.getTaskBean().getCurrentProcessStatus();
	Long tokenId = purchase.getTaskBean().getTokenId();
	Long taskInstanceId = purchase.getTaskBean().getTaskInstanceId();
	Long processInstanceId = purchase.getTaskBean().getProcessInstanceId();
%>
<form name="frm" action="<%=path %>/purchase/modifyPurchase.do" method="post">
	
	<input type="hidden" name="purchaseId" value="<%=id %>" />
	<input type="hidden" name="taskInstanceId" value="<%=taskInstanceId %>" />

	<table align="center" border="1">
		<tr align="center">
			<td colspan="2"><b>Modify Purchase</b></td>
		</tr>
		<tr>
			<td>Id:</td>
			<td><%=id %></td>
		</tr>
		<tr>
			<td>Title:</td>
			<td>
				<input type="text" name="title" value="<%=title %>">
			</td>
		</tr>
		</tr>
		<tr>
			<td>Remark:</td>
			<td>
				<input type="text" name="remark" value="<%=remark %>">
			</td>
		</tr>
		<tr>
			<td>IssuePerson:</td>
			<td><%=issuePerson %></td>
		</tr>
		<tr>
			<td>TaskInstanceId:</td>
			<td><%=taskInstanceId %></td>
		</tr>
		<tr>
			<td>Status:</td>
			<td><%=processStatus %></td>
		</tr>
		<tr>
			<td>Image:</td>
			<td><a href="#" onclick="processImage('<%=path %>/jbpmProcessImagePositionServlet.jbpm?tokenId=<%=tokenId %>');">ProcessImage</a></td>
		</tr>
		<tr align="center">
			<td colspan="2">
				<input type="button" value="modify" onclick="validateForm();" /> 
			</td>
		</tr>
	</table>
</form>

<p>
<iframe name="mainFrame" src="<%=path %>/jpbmProcessHistory.jbpm?processInstanceId=<%=processInstanceId %>" frameborder="0" marginheight="0" marginwidth="0"  width="100%" height="200"></iframe>
</p>

</body>
</html>